package com.smartfast4j.common.controller;

import com.smartfast4j.sys.service.IUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.servlet.ModelAndView;

/**
 * Created by gacl on 2017/8/30.
 */
@Controller
public class IndexController {

    @Autowired
    private IUserService userService;

    @RequestMapping(value = "/", method = RequestMethod.GET)
    public ModelAndView index() {
        /**
         * 这里要注意的是，如果Controller中返回视图加了后缀html或者btl，在配置中就不要加入suffix配置，否则会找不到页面。
         */
        //ModelAndView view = new ModelAndView("/beetlIndex.html");
        ModelAndView modelAndView = new ModelAndView("/beetlIndex");
        modelAndView.addObject("userList", userService.selectList(null));
        return modelAndView;
    }
}
